<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\ConfigSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '系统设置';
$this->params['breadcrumbs'][] = $this->title;
?>
<?php $this->registerCssFile('config.css'); ?>


<div class="config-index">

    <div class="tab-wrap">
        <ul class="tab-nav nav">
            <li class="current"><a href="javascript:void(0)">基本配置</a></li>
            <li><a href="javascript:void(0)">内容配置</a></li>
            <li><a href="javascript:void(0)">用户配置</a></li>
            <li><a href="javascript:void(0)">系统配置</a></li>
        </ul>

        <!--        <form action="" method="post" class="form-horizontal">-->

<?php $form = ActiveForm::begin(['action' => ['config/index'], 'method' => 'post',]); ?>

        <!--基本设置开始-->

        <div class="tab-content" style="display:block;">

            <div class="form-item">
                <label class="item-label">网站标题<span class="check-tips">（网站标题前台显示标题）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-large" name="config[WEB_SITE_TITLE]" value="<?=$data['WEB_SITE_TITLE']?>">				
                </div>
            </div><div class="form-item">
                <label class="item-label">网站描述<span class="check-tips">（网站搜索引擎描述）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[WEB_SITE_DESCRIPTION]"><?=$data['WEB_SITE_DESCRIPTION']?></textarea>
                    </label>				
                </div>
            </div><div class="form-item">
                <label class="item-label">关闭站点<span class="check-tips">（站点关闭后其他用户不能访问，管理员可以正常访问）</span> </label>
                <div class="controls">
                    <select name="config[WEB_SITE_CLOSE]">
                        <option value="0" <?php if($data['WEB_SITE_CLOSE'] == 0){ echo " selected=''";}?>>关闭</option>
                        <option value="1" <?php if($data['WEB_SITE_CLOSE'] == 1){ echo " selected=''";}?>>开启</option>
                    </select>				
                </div>
            </div><div class="form-item">
                <label class="item-label">网站关键字<span class="check-tips">（网站搜索引擎关键字）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[WEB_SITE_KEYWORD]"><?=$data['WEB_SITE_KEYWORD']?></textarea>
                    </label>				
                </div>
            </div><div class="form-item">
                <label class="item-label">网站备案号<span class="check-tips">（设置在网站底部显示的备案号，如“沪ICP备12007941号-2）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-large" name="config[WEB_SITE_ICP]" value="<?=$data['WEB_SITE_ICP']?>">				
                </div>
            </div><div class="form-item">
                <label class="item-label">后台色系<span class="check-tips">（后台颜色风格）</span> </label>
                <div class="controls">
                    <select name="config[COLOR_STYLE]">
<!--                    <option value="skin-red" selected="">默认</option>-->
                        
                        
                         <?php
                         foreach ($color_style as $v){
                             if($data['COLOR_STYLE'] == $v[0]){
                                 
                                  echo "<option value='".$v[0]."' selected>".$v[1]."</optiion>";
                             }else{
                                echo "<option value='".$v[0]."'>".$v[1]."</optiion>";
                                 
                                 
                             }
                             
                         }
                         
                         ?>
                       	
                    </select>				
                </div>
            </div>		<div class="form-item">
                <label class="item-label"></label>

            </div>


        </div>
        <!--基本设置 end-->

        <!--内容设置开始-->
        <div class="tab-content">

            <div class="form-item">
                <label class="item-label">回复列表每页条数<span class="check-tips">（）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-small" name="config[REPLY_LIST_ROWS]" value="<?=$data['REPLY_LIST_ROWS']?>">				
                </div>
            </div><div class="form-item">
                <label class="item-label">是否开启草稿功能<span class="check-tips">（新增文章时的草稿功能配置）</span> </label>
                <div class="controls">
                    <select name="config[OPEN_DRAFTBOX]">
                        <option value="0" <?php if($data['OPEN_DRAFTBOX'] == '0'){ echo " selected";}?>>关闭草稿功能</option>
                        <option value="1" <?php if($data['OPEN_DRAFTBOX'] == '1'){ echo " selected";}?>>开启草稿功能</option>			</select>				
                </div>
            </div><div class="form-item">
                <label class="item-label">自动保存草稿时间<span class="check-tips">（自动保存草稿的时间间隔，单位：秒）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-small" name="config[DRAFT_AOTOSAVE_INTERVAL]" value="<?=$data['DRAFT_AOTOSAVE_INTERVAL']?>">				
                </div>
            </div><div class="form-item">
                <label class="item-label">文档推荐位<span class="check-tips">（文档推荐位，推荐到多个位置KEY值相加即可）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[DOCUMENT_POSITION]">
                            <?=$data['DOCUMENT_POSITION']?>
                        </textarea>
                    </label>				
                </div>
            </div><div class="form-item">
                <label class="item-label">文档可见性<span class="check-tips">（文章可见性仅影响前台显示，后台不收影响）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[DOCUMENT_DISPLAY]">
                            <?=$data['DOCUMENT_DISPLAY']?>
                        </textarea>
                    </label>				
                </div>
            </div><div class="form-item">
                <label class="item-label">后台每页记录数<span class="check-tips">（后台数据每页显示记录数）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-small" name="config[LIST_ROWS]" value="<?=$data['LIST_ROWS']?>">				
                </div>
            </div>		<div class="form-item">
                <label class="item-label"></label>

            </div>

        </div>
        <!--内容设置结束-->


        <!--用户设置-->
        <div class="tab-content">
            <div class="form-item">
                <label class="item-label">是否允许用户注册<span class="check-tips">（是否开放用户注册）</span> </label>
                <div class="controls">
                    <select name="config[USER_ALLOW_REGISTER]">
                        <option value="0" <?php if($data['USER_ALLOW_REGISTER'] == '0'){ echo " selected";}?>>关闭注册</option>
                        <option value="1" <?php if($data['USER_ALLOW_REGISTER'] == '1'){ echo " selected";}?>>允许注册</option>			</select>				
                </div>
            </div>		<div class="form-item">
                <label class="item-label"></label>

            </div>
        </div>
        <!--用户设置结束-->


        <!--系统设置开始-->
        <div class="tab-content">
            <div class="form-item">
                <label class="item-label">是否显示页面Trace<span class="check-tips">（是否显示页面Trace信息）</span> </label>
                <div class="controls">
                    <select name="config[SHOW_PAGE_TRACE]">
                        <option value="0" <?php if($data['SHOW_PAGE_TRACE'] == '0'){ echo " selected";}?>>关闭</option>
                        <option value="1" <?php if($data['SHOW_PAGE_TRACE'] == '1'){ echo " selected";}?>>开启</option>		
                    </select>				
                </div>
            </div>
            
<!--            <div class="form-item">
                <label class="item-label">配置类型列表<span class="check-tips">（主要用于数据解析和页面表单的生成）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[CONFIG_TYPE_LIST]">
                            <?=$data['CONFIG_TYPE_LIST']?>
                        </textarea>
                    </label>				
                </div>
            </div>-->
<!--            <div class="form-item">
                <label class="item-label">预览插件的CodeMirror主题<span class="check-tips">（详情见CodeMirror官网）</span> </label>
                <div class="controls">
                    <select name="config[CODEMIRROR_THEME]">
                        <option value="3024-day">3024 day</option><option value="3024-night">3024 night</option><option value="ambiance" selected="">ambiance</option><option value="base16-dark">base16 dark</option><option value="base16-light">base16 light</option><option value="blackboard">blackboard</option><option value="cobalt">cobalt</option><option value="eclipse">eclipse</option><option value="elegant">elegant</option><option value="erlang-dark">erlang-dark</option><option value="lesser-dark">lesser-dark</option><option value="midnight">midnight</option>			</select>				
                </div>
            </div>-->
            
<!--            <div class="form-item">
                <label class="item-label">配置分组<span class="check-tips">（配置分组）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[CONFIG_GROUP_LIST]">1:基本
2:内容
3:用户
4:系统</textarea>
                    </label>				
                </div>
            </div>-->

            <div class="form-item">
                <label class="item-label">数据库备份根路径<span class="check-tips">（路径必须以 / 结尾）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-large" name="config[DATA_BACKUP_PATH]" value="<?=$data['DATA_BACKUP_PATH']?>">				
                </div>
            </div>
<!--<div class="form-item">
                <label class="item-label">钩子的类型<span class="check-tips">（类型 1-用于扩展显示内容，2-用于扩展业务处理）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[HOOKS_TYPE]">1:视图
2:控制器</textarea>
                    </label>				
                </div>
            </div>-->

<!--<div class="form-item">
                <label class="item-label">数据库备份卷大小<span class="check-tips">（该值用于限制压缩后的分卷最大长度。单位：B；建议设置20M）</span> </label>
                <div class="controls">
                    <input type="text" class="text input-small" name="config[DATA_BACKUP_PART_SIZE]" value="20971520">				
                </div>
            </div><div class="form-item">
                <label class="item-label">Auth配置<span class="check-tips">（自定义Auth.class.php类配置）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[AUTH_CONFIG]">AUTH_ON:1
AUTH_TYPE:2</textarea>
                    </label>				
                </div>
            </div><div class="form-item">
                <label class="item-label">数据库备份文件是否启用压缩<span class="check-tips">（压缩备份文件需要PHP环境支持gzopen,gzwrite函数）</span> </label>
                <div class="controls">
                    <select name="config[DATA_BACKUP_COMPRESS]">
                        <option value="0">不压缩</option><option value="1" selected="">启用压缩</option>			</select>				
                </div>
            </div><div class="form-item">
                <label class="item-label">数据库备份文件压缩级别<span class="check-tips">（数据库备份文件的压缩级别，该配置在开启压缩时生效）</span> </label>
                <div class="controls">
                    <select name="config[DATA_BACKUP_COMPRESS_LEVEL]">
                        <option value="1">普通</option><option value="4">一般</option><option value="9" selected="">最高</option>			</select>				
                </div>
            </div><div class="form-item">
                <label class="item-label">开启开发者模式<span class="check-tips">（是否开启开发者模式）</span> </label>
                <div class="controls">
                    <select name="config[DEVELOP_MODE]">
                        <option value="0">关闭</option><option value="1" selected="">开启</option>			</select>				
                </div>
            </div>-->

<!--            <div class="form-item">
                <label class="item-label">后台允许访问IP<span class="check-tips">（多个用逗号分隔，如果不配置表示不限制IP访问）</span> </label>
                <div class="controls">
                    <label class="textarea input-large">
                        <textarea name="config[ADMIN_ALLOW_IP]"></textarea>
                    </label>				
                </div>
            </div>		-->
        
        <div class="form-item">
                <label class="item-label"></label>



            </div>
        </div>
        <!--系统设置结束-->

        <div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
        </div>


<?php ActiveForm::end(); ?> 
        <!--</form>-->
    </div>


    <?php
    $js = <<<JS
            
        //tab 切换
        $(function() {
            $(".tab-nav li").click(function() {
                var idx = $(this).index();
                $(this).attr("class", "current").siblings(".tab-nav li").attr("class", "");
                $(".tab-content:eq(" + idx + ")").show().siblings(".tab-content").hide();
            })
        })       
JS;

    $this->registerJs($js);
    ?>



</div>
